<?php $frmuser = $this->frmusers;
$cancel_url = $this->url(array('module'=>'users','controller'=>'index','action'=>''),null,true);
?>
<style>
dt{ display: none;}
</style>
<form class="form-horizontal" id="popup-validation" enctype="multipart/form-data" method="post">
<div class="row">
	<div class="col-lg-12">
		<div class="box" style="width: 95%; margin: 0 auto;">
			<header class="dark">
				<div class="icons"><i class="icon-ok"></i></div>
					<h5>បន្ថែមប្រភេទអ្នកប្រើប្រាស់</h5>
                    <div class="toolbar">
                    	<ul class="nav">
							<li>
							<div style="float: right; margin-top: 3px;">	
	                        	<button type="submit" id="save" name="save" class="btn btn-primary btn-sm btn-grad"><i class="icon-save"> </i> រក្សាទុក</button>
	                        	<button type="submit" id="save_close" name="save_close" class="btn btn-primary btn-sm btn-grad"><i class="icon-save"> </i> រក្សាទុក​​ និង​ ចាកចេញ</button>                        		
	                        	<a href="<?php echo $cancel_url; ?>"><button​ type="button" class="btn btn-danger btn-sm btn-grad"><i class="icon-remove-sign"> </i> ចាកចេញ</button></a>
                            	<a class="accordion-toggle btn btn-xs minimize-box" data-toggle="collapse" href="#collapse2">
                                	<i class="icon-chevron-up"></i>
                                </a>
                                <button class="btn btn-xs btn-primary close-box"><i class="icon-group"></i></button>
                            </div>
                            </li>
                     	</ul>
                	</div>
          	</header>
			<div id="collapse2" class="body collapse in">				
                    <div style="float: left; text-align: left;" class="control-label col-lg-9">
						<div class="form-group">
	                    	<label class="control-label col-lg-4">​​​ភេទ   -  Gender :​ </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('gender');?>
	                        </div>                        
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4">​​​ប្រភេទខាសា   -  Branch Name :​ </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('branch_name');?>
	                        </div>                        
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> កូដសំគាល់  - ID Code : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('id_code');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> ឈ្មោះពេញ  - Full Name : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('fullname');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> ឈ្មោះអ្នកប្រើប្រាស់  - User Name : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('username');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> អ៊ីម៉ែល  - Email : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('email');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> លេខទូរស័ព្ទ  - Number Phone :</label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('phone');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> ពាក្យសម្ងាត់  - Password : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('password');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> អះអាងពាក្យសម្ងាត់   - Confirm Password :</label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('confirm_password');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> ប្រភេទឈ្មោះអ្នកប្រើប្រាស់ - User Type : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmuser->getElement('user_type');?>
	                        </div>
	               		</div>
               		</div>
               		<div class="form-group" >
	                	<div class="col-lg-3" style="float: right;">
	                    	<div class="fileupload fileupload-new" data-provides="fileupload">
	                        	<div class="fileupload-new thumbnail" style="width: 200px; height: 150px;"><img src="<?php echo $this->baseUrl()?>/assets/img/demoUpload.jpg" alt="" /></div>
	                        	<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
		                        <div>
		                       		<span class="btn btn-file btn-primary">
			                       		<span class="fileupload-new"><?php echo $frmuser->getElement('photo');?></span>
			                       		<span class="fileupload-exists">Change</span>
			                       		<input type="file" name="photo" />
		                       		</span>
		                        	<a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">Remove</a>
		                       	</div>
	                    	</div>
	               		</div>
                    </div>
                    <div class="form-group">
	                    	<label class="control-label col-lg-4">  </label>	                        
	               	</div>           	 	
           	</div>
		</div>
	</div>
</div>
</form>
<script>
<?php $getfillter_add =  $this->url(array('module'=>'users','controller'=>'index','action'=>'getfillteradd')); ?>
function getfillterUserType(){
	username = $('#username').val();
	$.ajax({
		url:"<?php echo $getfillter_add;?>",
		type:"post",
		data:{'username':username},
		success: function(data){	
			user_type = $.parseJSON(data);					
			if(user_type!=null){
				 for (var index = 1; index <= username.length; index++) {
					 alert(username[index-1]['username']+" is Already Exist!!");
				}
				 document.getElementById("username").style.borderColor="#FF0000";
				 document.getElementById("username").style.color="#FF0000";
				 document.getElementById("save").setAttribute('disabled', 'disabled');
				 document.getElementById("save_close").setAttribute('disabled', 'disabled');
			}else{
				document.getElementById("save").disabled = false;
				document.getElementById("save_close").disabled = false;
				document.getElementById("user_type").style.borderColor="";
				document.getElementById("user_type").style.color="#000";
			}
		},
		error:function(){
		}
	});
}
</script>